<?php
// Output headers and messages based upon the $section URL variable.
$site_title = "JIU Course Development Portal <span style='color:#ff0'>*BETA*</span>";

// Headers

switch($section) {
	
	case "courses":
	$header_output = ""; 
	if ($action == "add") $header_output .= "Add a Course"; 
	elseif ($action == "edit") $header_output .= "Edit a Course";
	else $header_output = "Courses";
	$dbTable = "courses";
	if     ($msg == "1") $output = "Please review and confirm the assignment content."; 
	elseif ($msg == "2") $output = "Please complete both the overview and procedure sections below.";
	elseif ($msg == "3") $output = "The course was added successfully."; 
	elseif ($msg == "4") $output = "The course was edited successfully.";
	else 	$output = "";
	$output_extend = "";
	break;
	/*
	case "ce":
	$header_output = ""; 
	if ($action == "add") $header_output .= "Add a Content Expert"; 
	elseif ($action == "edit") $header_output .= "Edit a Content Expert's Information";
	else $header_output = "Content Experts";
	$dbTable = "courses";
	if     ($msg == "1") $output = "Please review and confirm the assignment content."; 
	elseif ($msg == "2") $output = "Please complete both the overview and procedure sections below.";
	elseif ($msg == "3") $output = "The content expert was added successfully."; 
	elseif ($msg == "4") $output = "The content expert's information was edited successfully.";
	else 	$output = "";
	$output_extend = "";
	break;
	*/
	case "module_readings":
	$header_output = ""; 
	if ($action == "add") $header_output .= "Add "; 
	if ($action == "edit") $header_output .= "Edit ";
	$header_output .= " a Module Reading";
	$dbTable = "readings";
	$output = "";
	$output_extend = "";
	break;
	
	case "module_assignment":
	$header_output = ""; 
	if ($action == "add") $header_output .= "Add "; 
	else $header_output .= "Edit ";
	$header_output .= " a Module Assignment";
	$dbTable = "assignments";
	if     ($msg == "1") $output = "Please review and confirm the assignment content."; 
	elseif ($msg == "2") $output = "Please complete both the overview and procedure sections below.";
	elseif ($msg == "3") $output = "The assignment content was added successfully."; 
	elseif ($msg == "4") $output = "The assignment content was edited successfully.";
	else 	$output = "";
	$output_extend = "";
	break;
	
	case "module_exercise":
	$header_output = ""; 
	if ($action == "add") $header_output .= "Add "; 
	if ($action == "edit") $header_output .= "Edit ";
	$header_output .= " a Module Exercise";
	$dbTable = "exercises";
	$output_extend = "";
	break;
	
	case "module_theme":
	$header_output = ""; 
	if ($action == "add") $header_output .= "Add "; 
	if (($action == "edit") || ($action == "reveiw")) $header_output .= "Edit ";
	$header_output .= " Theme Content";
	$dbTable = "themes";
	if     ($msg == "1") $output = "Please review and confirm the theme's content."; 
	elseif ($msg == "2") $output = "Please make sure you have entered theme content.";
	elseif ($msg == "3") $output = "The theme content was added successfully."; 
	elseif ($msg == "4") $output = "The theme content was edited successfully.";
	else 	$output = "";
	$output_extend = "";
	break;
	
	case "module_home":
	$header_output = ""; 
	if ($action == "add") $header_output .= "Add "; 
	if ($action == "edit") $header_output .= "Edit ";
	$header_output .= " a Module Home Information";
	$dbTable = "readings";
	$output = "";
	$output_extend = "";
	break;
	
	case "user":
	$header_output = "Change "; 
	if ($action == "username") $header_output .= "Email Address"; 
	if ($action == "password") $header_output .= "Password";
	if     ($msg == "1") $output = "The user name provided is already in use, please provide another.";
	elseif ($msg == "2") $output = "There was a problem with the last request, please try again.";
	elseif ($msg == "3") $output = "Your current password was incorrect. Please try again.";
	elseif ($msg == "4") $output = "Please provide a user name.";
	else $output = "";
	$dbTable = "users";
	$output_extend = "";
	break;
	
	case "login":
	if ($action == "logout") $header_output = "Logged Out"; 
	else $header_output = "Log In";
	if     ($msg == "1") $output = "Sorry, there was a problem with your last login attempt.</div><p>Please make sure your user name and password are correct."; 
	elseif ($msg == "2") $output = "Your password has been randomly generated and reset to ".$go.".</div><p>You can now log in using your current username and the new password above.</p>";
	elseif ($msg == "3") $output = "You have been logged out. Log in again?"; 
	else $output = ""; 
	$output_extend = "";
	break;	
	
	// Proposal: Course Description
	case "cd":
	if ($action == "edit") $header_output = "Edit the Course Description"; 
	else $header_output = "Create the Course Description";
	if     ($msg == "1") $output = "Please review and confirm the course description."; 
	elseif ($msg == "2") $output = "Please complete both descriptions below.";
	elseif ($msg == "3") $output = "The course description was added successfully."; 
	elseif ($msg == "4") $output = "The course description was edited successfully.";
	else 	$output = "";
	$dbTable = "course_description";
	$output_extend = "";
	break;
	
	// Proposal: Course Project Description
	case "cpd":
	if ($action == "edit") $header_output = "Edit the Course Project Description"; 
	else $header_output = "Describe the Course Project"; 
	if     ($msg == "1") $output = "Please review and confirm the course project description."; 
	elseif ($msg == "2") $output = "Please provide a course description.";
	elseif ($msg == "3") { $output = "Step 1 is complete."; $output_extend = "<p>For reference, the course description from Step 1 is at the <a href='#bottom'>bottom</a> of the page.</p>"; }
	elseif ($msg == "4") $output = "The course project description was added successfully."; 
	elseif ($msg == "5") $output = "The course project description was edited successfully.";
	
	else 	$output = "";
	$dbTable = "course_project";
	$output_extend = "";
	break;
	
	// Proposal: Course Project Deliverable
	case "proj_deliv":
	$header_output = "Define the Project Deliverable(s) of Each Module";
	if     ($msg == "1") $output = "Please review and confirm the project deliverable."; 
	elseif ($msg == "2") $output = "Please complete all items.";
	elseif ($msg == "3") { $output = "Step 2 is complete."; $output_extend = "<p>For reference, the course description from Step 2 and the Course Project Description are at the <a href='#bottom'>bottom</a> of the page.</p>"; }
	elseif ($msg == "4") $output = "The project deliverable was added successfully."; 
	elseif ($msg == "5") $output = "The project deliverable was edited successfully.";
	else 	$output = "";
	$dbTable = "project_deliverable";
	$output_extend = "";
	break;
	
	// Proposal: Course Learning Outcomes
	case "clo":
	$header_output = "Develop Course Learning Outcomes Based on Weekly Project Deliverables";
	if     ($msg == "1") $output = "Step 3 is complete.";
	elseif ($msg == "3") $output = "Please review and confirm the learning outcome."; 
	elseif ($msg == "2") $output = "Please complete all items.";
	//elseif ($msg == "4") $output = "The learning outcome has been changed.";
	elseif ($msg == "4") $output = "The learning outcome was added successfully."; 
	elseif ($msg == "5") $output = "The learning outcome was edited successfully.";
	elseif ($msg == "9") $output = "The item has been deleted.";
	else 	$output = "";
	$dbTable = "learning_outcomes";
	$output_extend = "";
	break;
	
	// Proposal: Review Proposal Progress
	case "proposal_reveiw":
	$header_output = "Review the Proposal";
	$header_output_previous = "Step 4: Develop Course Learning Outcomes Based on Weekly Project Deliverables"; 
	$header_output_next = "Step 6: Provide Module, Theme, and Assignment Titles and a Module Overview";
	if     ($msg == "1") $output = "Step 4 is complete."; 
	elseif ($msg == "2") $output = "The Course Description has been updated.";
	elseif ($msg == "3") $output = "The Course Project Description has been updated.";
	elseif ($msg == "4") $output = "The Course Project Deliverable has been updated.";
	elseif ($msg == "5") $output = "The Course Learning Outcome has been updated.";
	else 	$output = "";
	break;
	
	case "proposal_titles":
	$header_output = "Provide Module, Theme, and Assignment Titles and a Module Overview";
	$header_output_previous = "Step 5: Review the Proposal";
	$header_output_next = "Step 7: Required Materials";
	if     ($msg == "1") $output = "Step 5 is complete.";
	elseif ($msg == "2") $output = "The module's title, theme titles, and assignment titles have been updated.";
	elseif ($msg == "3") $output = "The item was added successfully.";
	elseif ($msg == "4") $output = "The item was added successfully."; 
	elseif ($msg == "5") $output = "The item was edited successfully.";
	elseif ($msg == "9") $output = "The item has been deleted.";
	else 	$output = "";
	$output_extend = "";
	break;
	
	case "proposal_materials":
	$header_output = "Materials";
	$header_output_previous = "Step 6: Provide Module, Theme, and Assignment Titles and a Module Overview";
	$header_output_next = "Step 8: Inform the Instructional Designer";
	if     ($msg == "1") $output = "Step 6 is complete.";
	elseif ($msg == "3") $output = "Please review and confirm the required reading material information.";
	elseif ($msg == "4") $output = "The item was added successfully."; 
	elseif ($msg == "5") $output = "The item was edited successfully.";
	elseif ($msg == "9") $output = "The item has been deleted.";
	else 	$output = "";
	$output_extend = "";
	break;
	
	case "proposal_email":
	$header_output = "Inform the Instructional Designer";
	$header_output_previous = "Step 7: Required Materials";
	if     ($msg == "1") $output = "Step 7 is complete.";
	elseif ($msg == "2") $output = "Notification has been sent to the Instructional Designer. A copy of the message has been sent to you as well."; 
	else 	$output = "";
	$output_extend = "";
	break;
	
	case "comments":
	$header_output = "Comments";
	$header_output_previous = "";
	if     ($msg == "1") $output = "Please add a comment.";
	elseif ($msg == "2") $output = "Notification has been sent.";
	elseif ($msg == "3") $output = "The comment was added successfully."; 
	elseif ($msg == "4") $output = "The comment was edited successfully.";
	else 	$output = "";
	$output_extend = "";
	break;
	
	case "view_course":
	$header_output = $row_courses['jiu_course_id'].": ".$row_courses['name'];
	$header_output .= " - Course Progress";
	$output_extend = "";
	if     ($msg == "1") $output = "Information added successfully."; 
	elseif ($msg == "2") $output = "Information edited successfully.";
	elseif ($msg == "3") $output = "There was an error. Please try again.";
	elseif ($msg == "5") $output = "Information deleted successfully.";
	elseif ($msg == "8") $output = ""; 
	elseif ($msg == "9") $output = "The records have been updated.";
	elseif ($msg == "10") $output = "The user name you have entered is already in use.";
	else $output = "";
	break;
	
	case "view_comments":
	$header_output = "Comments";
	
		switch($dbTable) {
			case "modules": 				$header_output .= " - Module ".$mid;
			break;
			break;
			case "course_project": 			$header_output .= " - Course Project";
			break;
			case "course_description": 		$header_output .= " - Course Description";
			break;
			case "learning_outcomes": 		$header_output .= " - Learning Outcomes";
			break;
			case "project_deliverable": 	$header_output .= " - Project";
			break;
			case "assignments": 			$header_output .= " - Assignment";
			break;
			case "themes": 					$header_output .= " - Themes";
			break;
		}
	
	$header_output .= " - ".$row_courses['jiu_course_id'];
	break;
	
	case "view_proposal":
	$header_output = $row_courses['jiu_course_id'].": ".$row_courses['name'];
	
		switch($dbTable) {
			
			case "default": 
			$header_output .= " - Proposal Overview";
			break;
			
			case "project_deliverable":
			$header_output .= " - Project Deliverable ".$row_view_specific['del_num'];
			break;
			
			case "users":
			$header_output .= " - Content Expert";
			break;
			
		}
		
		switch($go) {
			case "default": 				$db_name = "";
			break;
			case "comments": 				$db_name = "comments";
			break;
			case "course_project": 			$db_name = "course project description";
			break;
			case "course_description": 		$db_name = "course description";
			break;
			case "learning_outcomes": 		$db_name = "learning outcome";
			break;
			case "project_deliverable": 	$db_name = "course project deliverable";
			break;
			case "assignments": 			$db_name = "assignment";
			break;
			case "themes": 					$db_name = "theme";
			break;
			case "modules": 				$db_name = "module";
			break;
			case "courses": 				$db_name = "course";
			break;
			case "users": 					$db_name = "user";
			break;
		}
	
	if     ($msg == "1") $output = "Information added successfully."; 
	elseif ($msg == "2") $output = "Information edited successfully.";
	elseif ($msg == "3") $output = "There was an error. Please try again.";
	elseif ($msg == "5") $output = "Information deleted successfully.";
	elseif ($msg == "6") $output = "The comment regarding the ".$db_name." was added successfully."; 
	elseif ($msg == "7") $output = "The comment regarding the ".$db_name." was edited successfully.";
	elseif ($msg == "8") $output = ""; 
	elseif ($msg == "9") $output = "The records have been updated.";
	elseif ($msg == "10") $output = "The user name you have entered is already in use.";
	else $output = "";
	$output_extend = "";
	break;
	
	case "dashboard":
	$header_output = "Dashboard for ".$row_user['firstName']." ".$row_user['lastName'];
	$output = "";
	$output_extend = "";
	break;
	
	case "ce":
	$header_output = "Content Experts";
		switch ($action) {
			case "add": 
			$header_output .= ": Add";
			break;
			case "edit":
			$header_output .= ": Edit";
			if ($go == "password") $header_output .= " Password";
			break;
		}
	if     ($msg == "1") $output = "The Content Expert was successfully added.";
	elseif ($msg == "2") $output = "The Content Expert you specified is already in the database.";
	elseif ($msg == "3") {
	$query_inform = sprintf("SELECT * FROM users WHERE id='%s'", $id);
	$inform = mysql_query($query_inform, $connection) or die(mysql_error());
	$row_inform = mysql_fetch_assoc($inform);
	$output = "The Content Expert's password has been changed to <em>".$saved."</em>. Be sure to <a href='mailto:".$row_inform['email']."?subject=New Password for the ".$site_title."&body=".$row_inform['firstName'].", your password for the ".$site_title." has been changed to ".$saved.". Your username remains the same.'>inform the CE</a> as soon as possible.";  
	}
	elseif ($msg == "4") $output = "The Content Expert's information has been updated.";
	elseif ($msg == "9") $output = "The Content Expert has been deleted from the database.";
	else 	$output = "";
	$dbTable = "users";
	break;
	
	case "id":
	$header_output = "Instructional Designers";
		switch ($action) {
			case "add": 
			$header_output .= ": Add";
			break;
			case "edit":
			$header_output .= ": Edit";
			break;
		}
	if     ($msg == "1") $output = "The Instructional Designer has been successfully added.";
	elseif ($msg == "2") $output = "The Instructional Designer you specified is already in the database."; 
	elseif ($msg == "3") {
	$query_inform = sprintf("SELECT * FROM users WHERE id='%s'", $id);
	$inform = mysql_query($query_inform, $connection) or die(mysql_error());
	$row_inform = mysql_fetch_assoc($inform);
	$output = "The Instructional Designer's password has been changed to <em>".$saved."</em>. Be sure to <a href='mailto:".$row_inform['email']."?subject=New Password for the ".$site_title."&body=".$row_inform['firstName'].", your password for the ".$site_title." has been changed to ".$saved.". Your username remains the same.'>inform the ID</a> as soon as possible.";  
	}
	elseif ($msg == "4") $output = "The Instructional Designer's information has been updated.";
	elseif ($msg == "9") $output = "The Instructional Designer has been deleted from the database.";
	else 	$output = "";
	$dbTable = "users";
	break;
	
	case "course":
	$header_output = "Courses";
		switch ($action) {
			case "add": 
			$header_output .= ": Add";
			break;
			case "edit":
			$header_output .= ": Edit";
			break;
			case "export": 
			$header_output .= ": Export";
			break;
			case "print":
			$header_output .= ": Print";
			break;
		}
	if     ($msg == "1") $output = "The course has been successfully added.";
	elseif ($msg == "2") $output = "The course you specified is already in the database.";
	elseif ($msg == "3") $output = "The course you specified has been archived.";  
	elseif ($msg == "4") $output = "The course's information has been updated.";
	elseif ($msg == "9") $output = "The course and all associated project information, modules, themes, and assignments have been deleted.";
	else 	$output = "";
	$dbTable = "courses";
	break;
	
	default:
	$header_output = "JIU Course Development Portal";
	$output = "";
	$output_extend = "";
	break;

}
$msg_output = "<div class='error_msg'>".$output."</div>".$output_extend;


// Viewer friendly DB Names

switch($dbTable) {
	
	case "project_deliverable": 	$db_friendly = "Course Project Deliverable"; break;
	case "course_project": 			$db_friendly = "Course Project Description"; break;
	case "course_description":  	$db_friendly = "Course Description"; break;
	case "learning_outcomes":		$db_friendly = "Learning Outcome"; break;
	case "assignments":				$db_friendly = "Assignment"; break;
	case "readings":				$db_friendly = "Reading"; break;
	case "materials":				$db_friendly = "Material"; break;
	case "themes":					$db_friendly = "Theme"; break;
	case "exercises":				$db_friendly = "Exercise"; break;
	case "instructor_notes":		$db_friendly = "Instructor Note"; break;
	case "default":					$db_friendly = ""; break;
}
?>

